//
//  ViewController.m
//  KKPhotosKitDemo
//
//  Created by liaozhenming on 2017/8/30.
//  Copyright © 2017年 liaozhenming. All rights reserved.
//

#import "ViewController.h"

#import "KKPhotosManager.h"
#import "KKPhotosManager+Preview.h"

@interface ViewController ()

@property (nonatomic, weak) IBOutlet UIImageView *imageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    [KKPhotosManager kk_defaultManager].resultBlock = ^(NSArray *images) {
        NSLog(@"images = %@", images);
    };
    
    [self.imageView addGestureRecognizer: [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(onTap:)]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)action_takePhotos:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePicture];
}

- (IBAction)action_takeEditPhotos:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureWithEdit: true];
}

- (IBAction)action_camera:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromCameraWithEdit:false];
}

- (IBAction)action_cameraEdit:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromCameraWithEdit:true];
}

- (IBAction)action_album:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromAlbumWithEdit:false];
}

- (IBAction)action_albumEdit:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromAlbumWithEdit: true];
}

- (IBAction)action_library:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromLibraryWithCountSize: 2];
}

- (IBAction)action_libraryEdit:(id)sender {
    [[KKPhotosManager kk_defaultManager] kk_takePictureFromLibraryWithCountSize: 2 original: true];
}

- (void)onTap:(UITapGestureRecognizer*)tapper {
    
    NSString *imagePath = [[NSBundle mainBundle] resourcePath];
//    imagePath = [imagePath stringByAppendingPathComponent: @"test.jpeg"];
    
    NSMutableArray *arr_imagePaths = [NSMutableArray array];
    for (NSInteger index = 0; index < 5; index++) {
        [arr_imagePaths addObject: [imagePath stringByAppendingPathComponent: @"test.jpeg"]];
    }
    imagePath = [imagePath stringByAppendingPathComponent: @"test.jpeg"];
    
    [KKPhotosManager kk_previewImageWithThumbImage: self.imageView.image orignImagePath: imagePath targetFrame: self.imageView.frame];
//    [KKPhotosManager kk_previewImagesWithImagePaths: arr_imagePaths];
}

@end
